package dao.impl;


import java.sql.SQLException;
import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;

import module.Customers;
import dao.ABSBasicDAO;
import domain.vo.queryObject;

public class CustomersDAOImpl extends ABSBasicDAO<Customers> {

	/**
	 * 构造方法
	 * @param sqlMapClient
	 */
	public CustomersDAOImpl(SqlMapClient sqlMapClient) {
		super(sqlMapClient);
	}
	
	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#getAll()
	 */
	@Override
	public List<Customers> getAll() throws SQLException {
		// TODO Auto-generated method stub
		return sqlMapClient.queryForList("Customers.getAll");
	}

	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#getById(java.lang.String)
	 */
	@Override
	public Customers getById(String id) throws SQLException {
		// TODO Auto-generated method stub
		return (Customers)sqlMapClient.queryForObject("Customers.getById", id);
	}

	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#getByPK()
	 */
	@Override
	public Customers getByPK() {
		// TODO Auto-generated method stub
		return super.getByPK();
	}

	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#insertT(java.lang.Object)
	 */
	@Override
	public void insertT(Customers t) throws SQLException {
		// TODO Auto-generated method stub
		sqlMapClient.insert("Customers.insertCustomesInfo", t);
	}

	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#updateT(java.lang.Object)
	 */
	@Override
	public void updateT(Customers t) throws SQLException {
		sqlMapClient.update("Customers.updateCustomesInfo", t);
	}
	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#updateT(java.lang.Object)
	 */
	@Override
	public int countByQueryObject(queryObject queryObject)throws SQLException  {
		return (Integer)sqlMapClient.queryForObject("Customers.countCustomeByQueryObject", queryObject);
	}
	
	/* (non-Javadoc)
	 * @see dao.ABSBasicDAO#getObjectByQueryObject(domain.vo.queryObject)
	 */
	@Override
	public List<Customers> getObjectByQueryObject(queryObject queryObject)
			throws SQLException {
		return (List<Customers>)sqlMapClient.queryForList("Customers.getCustomeByQueryObject", queryObject);
	}

}
